Skip to content

fix(http): add content-type override support for http request#10211

Merged
vicb merged 1 commit intoangular:masterfrom
joshgerdes:fix-http-contenttype
Jul 22, 2016
Merged

fix(http): add content-type override support for http request#10211
vicb merged 1 commit intoangular:masterfrom
joshgerdes:fix-http-contenttype

Conversation

@joshgerdes
Copy link
Copy Markdown
Contributor

@joshgerdes joshgerdes commented Jul 21, 2016

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior? (You can also link to an open issue here)
see #10210

What is the new behavior?
see #10210

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

Fix static request to allow the ‘Content-Type’ of a http request to be set from the headers options of the call.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that is a ridiculous typo. Sorry, will fix.

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jul 21, 2016

Run gulp as indicated in the contributing docs to fix the CI
Address inline comments
What about header case ? Can't remember of they are case sensitive
Thanks

@joshgerdes
Copy link
Copy Markdown
Contributor Author

Header field names are case-insensitive:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

I will change to lowercase.

And is the API update the gulp task I missed?
gulp public-api:update

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jul 21, 2016

gulp public-api:update

Yep, it will update the .d.ts golden files with public API changes. Read my latest inline comments and figure out if the public API needs to be updated ?

@vicb vicb added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jul 21, 2016
@googlebot
Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@joshgerdes joshgerdes force-pushed the fix-http-contenttype branch from 52dcd45 to c665bd5 Compare July 21, 2016 16:55
@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jul 21, 2016

Please merge the commits and add a test

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user has specified a content-type that isn't in a case statement, won't default override that? Should detecting from the body only occur if the content type is not specified?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if not found it would default to whatever type it determined from the body. I was assuming that the limited content types specified as enums were the 'supported' types. And in the future the switch statement could be expanded as more enums are added/supported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this PR does not change the behavior vs the previous impl.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes I still want to send an empty content-type header. Now it always detects it from the body, can I somehow override that?

@joshgerdes joshgerdes force-pushed the fix-http-contenttype branch from 38923d9 to fd6448c Compare July 21, 2016 20:27
@joshgerdes
Copy link
Copy Markdown
Contributor Author

Tests added and squashed the commits.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a return type

Fix static request to allow the ‘Content-Type’ of a http request to be set from the headers options of the call.
@joshgerdes joshgerdes force-pushed the fix-http-contenttype branch from fd6448c to cb937bc Compare July 21, 2016 21:30
@joshgerdes
Copy link
Copy Markdown
Contributor Author

Updated.

And yes, that missing semi-colon really did mess with the formatter.

@vicb vicb merged commit bdb5912 into angular:master Jul 22, 2016
hbkrunal pushed a commit to hbkrunal/angular that referenced this pull request Sep 15, 2016
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants